package com.haiyi.test.demo;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.io.Resource;
import org.yaml.snakeyaml.Yaml;

import java.io.IOException;
import java.util.Map;

public class Main {
    public static void main(String[] args){
       /* System.out.println("---");
        ApplicationContext ac = new ClassPathXmlApplicationContext();
        try {
            Resource[] resources = ac.getResources("classpath*:com/*.properties");
            System.out.println(resources != null ? resources.length : 0);
            for (Resource resource : resources) {
                System.out.println(resource);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }*/

        Yaml yml = new Yaml();
        Object result = yml.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("abc.yml"));
        System.out.println(result.getClass());
        System.out.println(result);
        Map map = (Map) result;
        System.out.println(map.get("ya").getClass());

    }
}
